package com.blensmile.network;

import android.os.Handler;
import android.os.Message;

import com.blensmile.BaseActivity;
import com.blensmile.network.models.ErrorResponse;
import com.blensmile.utils.AppManager;



/**
 * Created by Blensmile on 2017/3/16.
 */

public class ErroHandle /*implements ErrorHandler*/{
//    public ErroHandle() {
//    }
//
//    @Override
//    public Throwable handleError(RetrofitError cause) {
//        try{
//            ErrorResponse errorResponse = (ErrorResponse) cause.getBodyAs(ErrorResponse.class);
//            if(errorResponse !=null && errorResponse.getCode().size()> 0){
//                BaseActivity activity = ((BaseActivity)(AppManager.getAppManager().currentActivity()));
//                if(activity != null){
//                    Handler handler  = activity.BaseHandler;
//                    if(handler != null){
//                        Message message = handler.obtainMessage();
//                        message.what = 1;
//                        message.obj = errorResponse.getCode().get(0);
//                        handler.sendMessageDelayed(message,500);
//                    }
//                }
//            }
//        }catch (Exception e){
//            e.printStackTrace();
//        }
//        return new Exception(cause);
//    }
}
